package com.heima.zuoye.day07.timu1;

import java.util.Comparator;
import java.util.Random;
import java.util.TreeSet;

public class Demo1 {
    public static void main(String[] args) {
        Random r = new Random();
        TreeSet<Integer> set = new TreeSet<>();
        while (set.size()<10){
            set.add(r.nextInt(0, 51));
        }
        set.forEach(integer -> System.out.println(integer));
        TreeSet<Integer> set2 = new TreeSet<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2 - o1;
            }
        });
        while (set2.size()<10){
            set2.add(r.nextInt(0, 51));
        }
        System.out.println("===========================");
        set2.forEach(i -> System.out.println(i));
    }
}
